from peewee import *
import datetime

db = MySQLDatabase('book', user="root", password="123000")

class BaseModel(Model):
  class Meta:
    database = db

class Book(BaseModel):
  bookid= IntegerField(unique=True)
  name = CharField()
  desc = CharField()
  url = CharField()
  img = CharField()
  level = CharField()
  levelsub = CharField()
  status = CharField()
  createdAt = DateTimeField(constraints=[SQL('DEFAULT CURRENT_TIMESTAMP')])
  updatedAt = DateTimeField(default=datetime.datetime.now())

db.connect()
db.create_tables([Book])
